<template>
  <div>
    <!-- 表格 -->
    <div class="tenant-info">
      <el-table :key="tableKey" :data="blacklist" stripe fit highlight-current-row class="refund-table" empty-text="暂无数据">
        <el-table-column label="求职者用户名" :show-overflow-tooltip="true" align="center">
          <template slot-scope="{ row }"><span>{{ row.username }}</span></template>
        </el-table-column>
        <el-table-column label="求职者邮箱" :show-overflow-tooltip="true" align="center">
          <template slot-scope="{ row }"><span>{{ row.email }}</span></template>
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="{ row }">
            <el-popconfirm
              title="是否取消屏蔽？"
              @onConfirm="remove(row.employerId,row.employeeId)"
            >
              <el-button slot="reference" type="text" size="small">取消屏蔽</el-button>
            </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import {
  cancelBlacklist,
  getBlacklist
} from '@/api/user'
export default {
  data() {
    return {
      tableKey: 0,
      blacklist: null
    }
  },
  created() {
    this.getBlacklist()
  },
  methods: {
    remove(employerId, employeeId) {
      var param = { employerId: employerId, employeeId: employeeId }
      cancelBlacklist(param).then(
        (response) => {
          this.$message.success('取消屏蔽成功')
          this.getBlacklist()
        },
        (error) => {
          this.$message.error(error.message)
        }
      )
    },
    // 获取黑名单信息
    getBlacklist() {
      getBlacklist().then(
        (response) => {
          // console.log(response)
          this.blacklist = response.data
          // console.log(this.blacklist)
        }
      )
    }
  }
}

</script>
